package com.hdb;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by aszer on 2016/11/21.
 */
@Entity
@Table(name = "my_order", schema = "testin", catalog = "")
public class TMyOrder {
    private int orderId;
    private int userId;
    private Timestamp orderDate;
    private int orderState;
    private String orderEmail;
    private int orderPayType;
    private int orderPrice;
    private String orderNumber;

    @Id
    @Column(name = "order_id", nullable = false)
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "order_date", nullable = false)
    public Timestamp getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Timestamp orderDate) {
        this.orderDate = orderDate;
    }

    @Basic
    @Column(name = "order_state", nullable = false)
    public int getOrderState() {
        return orderState;
    }

    public void setOrderState(int orderState) {
        this.orderState = orderState;
    }

    @Basic
    @Column(name = "order_email", nullable = false, length = 128)
    public String getOrderEmail() {
        return orderEmail;
    }

    public void setOrderEmail(String orderEmail) {
        this.orderEmail = orderEmail;
    }

    @Basic
    @Column(name = "order_pay_type", nullable = false)
    public int getOrderPayType() {
        return orderPayType;
    }

    public void setOrderPayType(int orderPayType) {
        this.orderPayType = orderPayType;
    }

    @Basic
    @Column(name = "order_price", nullable = false)
    public int getOrderPrice() {
        return orderPrice;
    }

    public void setOrderPrice(int orderPrice) {
        this.orderPrice = orderPrice;
    }

    @Basic
    @Column(name = "order_number", nullable = false, length = 32)
    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TMyOrder tMyOrder = (TMyOrder) o;

        if (orderId != tMyOrder.orderId) return false;
        if (userId != tMyOrder.userId) return false;
        if (orderState != tMyOrder.orderState) return false;
        if (orderPayType != tMyOrder.orderPayType) return false;
        if (orderPrice != tMyOrder.orderPrice) return false;
        if (orderDate != null ? !orderDate.equals(tMyOrder.orderDate) : tMyOrder.orderDate != null) return false;
        if (orderEmail != null ? !orderEmail.equals(tMyOrder.orderEmail) : tMyOrder.orderEmail != null) return false;
        if (orderNumber != null ? !orderNumber.equals(tMyOrder.orderNumber) : tMyOrder.orderNumber != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = orderId;
        result = 31 * result + userId;
        result = 31 * result + (orderDate != null ? orderDate.hashCode() : 0);
        result = 31 * result + orderState;
        result = 31 * result + (orderEmail != null ? orderEmail.hashCode() : 0);
        result = 31 * result + orderPayType;
        result = 31 * result + orderPrice;
        result = 31 * result + (orderNumber != null ? orderNumber.hashCode() : 0);
        return result;
    }
}
